<?php
namespace Home\Model;
use Think\Model;
class asdfgModel extends Model {
    protected $tableName = "purse";

    protected $_validate = array(
        array('money','require','金额必须填写')
    );

    public function chongzi(){
        $money = $_REQUEST['money'];//用户要充值的金额
        $id = session('id');//用户id

        $where['information_id'] = $id;
        $data['money'] = $money;
        $names = M('purse')->where($where)->save($data);
        if(empty($names)){
            $this->error="充值失败!!";
        }
        return $names;
    }
}